= form_for(@car) do |f|
  - if @car.errors.any?
    #error_explanation
      %h2
        = pluralize(@car.errors.count, "error")
        prohibited this car from being saved:
      %ul
        - @car.errors.full_messages.each do |message|
          %li= message
  %table.table.table-bordered
    %tr
      %th{width: 150}
        %label 名称
      %td
        = f.text_field :name, class: "form-control"
    %tr
      %th
        %label 品牌
      %td
        = f.text_field :brand, class: "form-control"
    %tr
      %th
        %label 主型号
      %td
        = f.text_field :version_main, class: "form-control"
    %tr
      %th
        %label 分型号
      %td
        = f.text_field :version_sub, class: "form-control"
    %tr
      %th
        %label 车牌号
      %td
        = f.text_field :plate_number, class: "form-control"
    %tr
      %th
        %label 挂靠
      %td
        = f.check_box :attached
    %tr
      %th
        %label 发动机号
      %td
        = f.text_field :engine_number, class: "form-control"
    %tr
      %th
        %label 车架号
      %td
        = f.text_field :frame_number, class: "form-control"
    %tr
      %th
        %label 注册日期
      %td
        = f.text_field :register_date, class: "form-control"
    %tr
      %th
        %label 类型
      %td
        = f.text_field :auto_type, class: "form-control"
    %tr
      %th
        %label 颜色
      %td
        = f.text_field :color, class: "form-control"
    %tr
      %th
        %label 车主姓名
      %td
        = f.text_field :owner_name, class: "form-control"
    %tr
      %th
        %label 车主电话
      %td
        = f.text_field :owner_mobile, class: "form-control"
    %tr
      %th
        %label 年检到期日期
      %td
        = f.text_field :inspection_peroid_of_validity, class: "form-control"
  .actions{style: "float:left;margin-right:10px;"}
    = f.submit '保存车辆', class: 'btn btn-primary'

= javascript_include_tag '//cdn.bootcss.com/moment.js/2.10.6/moment.min.js'
= stylesheet_link_tag     '//ycpublic.oss-cn-beijing.aliyuncs.com/static/bootstrap-datetimepicker.css'
= javascript_include_tag     '//ycpublic.oss-cn-beijing.aliyuncs.com/static/bootstrap-datetimepicker.min.js'

:javascript
  $('#car_register_date').datetimepicker({
      format: 'yyyy-mm-dd',
      todayHighlight: true,
      startView:2,
      maxView:3,
      minView:2
  });
  $('#car_inspection_peroid_of_validity').datetimepicker({
      format: 'yyyy-mm-dd',
      todayHighlight: true,
      startView:2,
      maxView:3,
      minView:2
  });
  $('#car_register_date').click(function(){
    $('.icon-arrow-left').addClass('glyphicon glyphicon-chevron-left');
    $('.icon-arrow-right').addClass('glyphicon glyphicon-chevron-right');
  });
  $('#car_inspection_peroid_of_validity').click(function(){
    $('.icon-arrow-left').addClass('glyphicon glyphicon-chevron-left');
    $('.icon-arrow-right').addClass('glyphicon glyphicon-chevron-right');
  });